]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
NotificationDaemon: don't notify for resident notifications when application is focused
authorNeha Doijode <ndoijode@gmail.com>
Mon, 21 Mar 2011 21:26:04 +0000 (02:56 +0530)
committerMarina Zhurakhinskaya <marinaz@redhat.com>
Tue, 22 Mar 2011 01:58:29 +0000 (21:58 -0400)
The applications have to have a way of keeping resident notifications
updated without unnecessarily notifying the user with the information
the user is already seeing in the application window.

https://bugzilla.gnome.org/show_bug.cgi?id=630847

js/ui/notificationDaemon.js

index 2a59d983342dbc4eb955d69d6fe8375cd96369f4..e807af4860ae350d023173490e23f56b38669941 100644 (file)
@@ -346,7 +346,7 @@ NotificationDaemon.prototype = {
         notification.setTransient(hints['transient'] == true);
 
         let sourceIconActor = source.useNotificationIcon ? this._iconForNotificationData(icon, hints, source.ICON_SIZE) : null;
-        source.notify(notification, sourceIconActor);
+        source.processNotification(notification, sourceIconActor);
     },
 
     CloseNotification: function(id) {
@@ -445,12 +445,17 @@ Source.prototype = {
         this._trayIcon = null;
     },
 
-    notify: function(notification, icon) {
+    processNotification: function(notification, icon) {
         if (!this.app)
             this._setApp();
         if (!this.app && icon)
             this._setSummaryIcon(icon);
-        MessageTray.Source.prototype.notify.call(this, notification);
+
+        let tracker = Shell.WindowTracker.get_default();
+        if (notification.resident && this.app && tracker.focus_app == this.app)
+            this.pushNotification(notification);
+        else
+            this.notify(notification);
     },
 
     handleSummaryClick: function() {